#!/bin/bash
dt=` date +"%Y-%m-%d"`
dt1=`date -d "-1 day" +"%Y-%m-%d"`
arr=(AML_ACCOUNT_MASTER AML_TRANSACTION_DETAIL AML_UBO_INFO AML_WATCHLIST_DETAIL AML_SCREENING_RESULT AML_ALERT)

for i in ${arr[@]};do
ods_aml="ODS_$i"
sqoop import \
--connect jdbc:oracle:thin:@192.168.65.4:1521:orcl \
--username AML \
--password 123456 \
--table $i \
--hcatalog-database ods \
--where "CREATED_DATE="$dt1"" \
--hcatalog-table $ods_aml \
--hive-partition-key etl_date \
--hive-partition-value $dt \
-m 1
done

sqoop import \
--connect jdbc:oracle:thin:@192.168.65.4:1521:orcl \
--username AML \
--password 123456 \
--table AML_WATCHLIST_MASTER \
--hcatalog-database ods \
--where "UPDATED_DATE="$dt1"" \
--hcatalog-table ODS_AML_WATCHLIST_MASTER \
--hive-partition-key etl_date \
--hive-partition-value $dt \
-m 1

sqoop import \
--connect jdbc:oracle:thin:@192.168.65.4:1521:orcl \
--username AML \
--password 123456 \
--table AML_SUSPICIOUS_TXN_REPORT \
--hcatalog-database ods \
--where "REPORT_DATE="$dt1"" \
--hcatalog-table ODS_AML_SUSPICIOUS_TXN_REPORT \
--hive-partition-key etl_date \
--hive-partition-value $dt \
-m 1